home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / buttonfly / README < prev    next >
Text File  |  1994-08-01  |  8KB  |  166 lines

  1.  
  2.                       toolbox/src/demos/GL/buttonfly README
  3.  
  4.      Buttonfly is a hierarchical, graphical menu system.  It provides a
  5.      simple-to-use graphical interface for launching applications.
  6.  
  7.      Buttonfly uses a hiercharical menu structure which is designed to
  8.      be easily configurable.  What follow is a liberal extract from the
  9.      buttonfly(6D) man page on how to configure Buttonfly to better
  10.      customize it to fit your needs.
  11.  
  12.      To run an example, execute the "buttonfly.sh" script.  See the files
  13.      in the "menus" directory for more info.
  14.  
  15.  
  16. RECONFIGURING BUTTONFLY
  17.  
  18.      Buttonfly's menus were designed to be simple to change with any UNIX
  19.      text editor (such as vi ).  When it is run with no arguments, it looks
  20.      for button descriptions in a file called '.menu' in the current
  21.      directory.  If it is given one argument, it will look in that file
  22.      for button definitions instead.
  23.  
  24.      Buttonfly uses a very simple format to describe its buttons.  The
  25.      format has four different kinds of lines: comments, titles, actions,
  26.      and commands.
  27.  
  28.      Any line beginning with a '#' character is considered a comment and is
  29.      ignored.
  30.  
  31.      Button titles, like comments, always start in the first column of the
  32.      file, and may be anything not starting with a '#'.  Titles may be a
  33.      maximum of 36 characters long; buttonfly will automatically separate the
  34.      title into a maximum of three lines of twelve characters, separating
  35.      words in the title at spaces.
  36.  
  37.      Action lines start with a tab and end with a newline, and may be any
  38.      UNIX command.  Multiple actions may be specified for a button by listing
  39.      them after the button one per line, each starting with a tab.  Actions
  40.      may not span more than one line, but may be any length.  If no actions
  41.      are speci- fied for a button, the button is displayed, but nothing will
  42.      happen when it is selected.
  43.  
  44.      Commands, like actions, start with a tab character.  Currently, the
  45.      commands recognized are '.menu.', '.popup.', '.cd.', '.color.',
  46.      '.backcolor.', and '.highcolor.'.  Everything else is assumed to be an
  47.      action and will be executed as a UNIX command in a shell (see sh(1)).
  48.  
  49.      The special action called '.menu.' is used to specify a button that has
  50.      several buttons attached to the back of it.  When buttonfly sees '.menu.
  51.      filename' it will create a new set of buttons from the descriptions in
  52.      'filename'.  If it cannot find 'filename' in the current directory, then
  53.      nothing happens.  If 'filename' is '-', then the new set of buttons is
  54.      created from the standard output of the previous actions (see example
  55.      below).  Note that any 'cd' commands in an action list do not affect the
  56.      directory in which buttonfly looks for the filenames specified in
  57.      '.menu.' commands, becuase actions are executed in a sub-shell (see the
  58.      '.cd.' command below).
  59.  
  60.      Another special actions is '.popup.'.  It is used to define a pop-up
  61.      menu entry attached to a button.  When buttonfly sees '.popop. title'
  62.      it adds an entry 'title' to the button's pop-up menu.  The actions
  63.      following a .popup. command will be executed when that menu entry is
  64.      chosen.  Buttonfly automatically provides a 'Do It' entry, which has
  65.      the same effect as pressing the left mouse button.
  66.  
  67.      The '.cd.' action is used to change buttonfly's idea of the current
  68.      working directory.  When the button containing the .cd. command is
  69.      pressed, buttonfly will chdir into that directory before executing
  70.      that button's actions, and all buttons underneath that button will
  71.      also be executed in that directory (unless they also have .cd. commands).
  72.      Note that executing the regular 'cd' shell command in a button does not
  73.      affect buttonfly's idea of the current working directory, since all
  74.      button actions are executed in their own shell environment.
  75.  
  76.      The command '.color.' followed by three numbers in the range 0.0 ... 1.0
  77.      specifies the red, green and blue components of a button's color, and
  78.      '.highcolor' does the same for the color of the button as it is being
  79.      selected.  '.backcolor.' changes the color of the back of the button,
  80.      which becomes the background color of the next set of buttons (displayed
  81.      when the button flips over).  Note that using color commands at the top
  82.      of a file, before any buttons have been defined, causes the default
  83.      colors to be changed for all subsequent buttons.  To change the
  84.      background color to red for the first button and all subsequent
  85.      buttons you would specify:
  86.  
  87.           .backcolor. 1.0 0.0 0.0
  88.  
  89.      in the menu description file before any buttons are defined.
  90.  
  91. EXAMPLES
  92.  
  93.      The following are example buttonfly .menu files, with descriptions of
  94.      what they do.
  95.  
  96.      This is a very simple button called 'First' that has the buttons defined
  97.      in the file '.menu_second' on the back of it.
  98.  
  99.           First
  100.                .menu. .menu_second
  101.  
  102.      Here are three buttons.  The 'Parent' button is purple and will flip
  103.      over and display the other two buttons when pressed (they will be
  104.      displayed on a purple background, since that is the color on the back
  105.      of the first button).  The 'Demonstrate...' button changes directories
  106.      and then runs a program when pressed, and 'Recurse' flips over and shows
  107.      the first button again, this time on a blue background since the
  108.      '.backcolor.' command changes the background color to blue.
  109.  
  110.           #Save this in a file called '.menu'
  111.           Parent
  112.                .color. .89 .10 .89
  113.                .backcolor. .89 .10 .89
  114.                .highcolor. 1.0 .5 1.0
  115.                .menu. child
  116.  
  117.           #Save the following buttons in a file called 'child'
  118.           Demonstrate GL/NeWS Interface
  119.                cd /usr/NeWS/demo
  120.                glnews
  121.           Recurse
  122.                .backcolor. 0.0 0.0 1.0
  123.                .menu. .menu
  124.  
  125.      Here is a very complicated button, which builds a button file based
  126.      on the files it finds in a directory full of files.  When pressed,
  127.      it builds the file and then uses .menu.  to flip over, exposing entries
  128.      for all the files it found.  Note that this allows you to delete or add
  129.      image files, and the buttons will always be accurate.  It also has a
  130.      pop-up menu on it giving help; the first .popup command specifies the
  131.      title of the menu using the %t feature of Silicon Graphics menus.
  132.  
  133.           Show An Image
  134.                cd /usr/demos/data/images
  135.           #The following two lines must all be on the
  136.           # same line in the .menu file
  137.                /bin/ls *.rgb | awk 'BEGIN{FS="."}{print "Show " $1
  138.           "\n\tipaste /usr/demos/data/images/" $0 "\n"}'
  139.                .menu. -
  140.                .popup. ShowImage Menu %t
  141.                .popup. Ipaste Man Page
  142.                wsh -c man ipaste
  143.  
  144. BUGS
  145.  
  146.      Buttonfly will not work if the first character of a file is a TAB
  147.      followed by anything other than .color., .backcolor., or .highcolor.
  148.      It is safest to eliminate any blank lines from the files you create.
  149.  
  150.      Buttonfly may crash if given an arbitrary file as input.
  151.  
  152.      The maximum number of buttons on any level of the hierarchy is 32.
  153.  
  154.      If a program fails to run, nothing happens-- no error messages or
  155.      warnings are given.  This can be considered either a feature or a bug.
  156.  
  157.      Specifying %F, %f, %x, or %m as part of a .popup. title will give bad
  158.      results, and may crash the program.  Using %t to specify a title works,
  159.      but any actions specified for that entry will never be executed (since
  160.      it is impossible to select a title entry).
  161.  
  162. FILES
  163.  
  164.      /usr/demos/.m* are the button files the demos use.
  165.  
  166.